package com.auxgroup.hr.front.service.personnal.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsCTactPerTbl;
import com.auxgroup.hr.front.dao.repository.PsCTactPerTblRepository;
import com.auxgroup.hr.front.service.personnal.TactPerTblService;

/** 
 * @author wangchangyun
 * @version 创建时间：180523 
 * 紧急情况联系人service
 */
@Service("tactPerTblService")
public class TactPerTblServiceImpl implements TactPerTblService {
	private static final Logger logger = LoggerFactory.getLogger(TactPerTblServiceImpl.class);
	
	@Autowired
	private PsCTactPerTblRepository PsCTactPerTblRepository;


	@Override
	public PsCTactPerTbl getTactPerTbl(String emplid) {
		return PsCTactPerTblRepository.findOne(emplid);
	}


	@Override
	public PsCTactPerTbl save(PsCTactPerTbl TactPerTbl) {
		return PsCTactPerTblRepository.save(TactPerTbl);
	}


	@Override
	public Boolean delete(String emplid) {
		try {
			PsCTactPerTblRepository.delete(emplid);
		} catch (Exception e) {
			logger.error("delete TactPerTbl error: emplid={}",emplid,e);
			return false;
		}
		return true;
	}
	
	
	@Override
	public List<PsCTactPerTbl> getAll() {
		PsCTactPerTbl TactPerTbl = new PsCTactPerTbl();
		return PsCTactPerTblRepository.findAll(Example.of(TactPerTbl));
	}


	
	
	
}
